package com.company.netease2021;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main2 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int res = getLongestStr(s);
        System.out.println(res);
        br.close();

    }

    private static int getLongestStr(String s) {
        int res = 0;
        if(s == null || s.length() <= 1){
            return res;
        }
        int len = s.length();
        for (int i = 0; i < len; i++) {
            for (int j = i; j < len; j++) {
                String str = s.substring(i,j + 1);
                int[] count = new int[6];
                for (int k = 0; k < str.length(); k++) {
                    if(str.charAt(k) == 'a'){
                        count[0]++;
                    }else if(str.charAt(k) == 'b'){
                        count[1]++;
                    }else if(str.charAt(k) == 'c'){
                        count[2]++;
                    }else if(str.charAt(k) == 'x'){
                        count[3]++;
                    }else if(str.charAt(k) == 'y'){
                        count[4]++;
                    }else if(str.charAt(k) == 'z'){
                        count[5]++;
                    }

                }
                boolean flag = true;
                for (int k = 0; k < 6; k++) {
                    if((count[k] & 1) ==1){
                        flag = false;
                        break;
                    }
                }
                if (flag){
                    res = Math.max(res,str.length());
                }

            }
        }

        return res;


    }
}
